package com.itheima.manager.contrller;

import com.itheima.manager.domain.Subway;
import com.itheima.manager.service.SubwayService;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Properties;
import java.util.Scanner;

public class SubwayController {
    static Scanner sc = new Scanner(System.in);
    static SubwayService service = new SubwayService();

    public void start() {
        System.out.println("=====================欢迎您来到北京地铁系统=====================");
        System.out.println("请输入您的选择:1.增加地铁站信息\t2.查询地铁站信息\t3.退出系统");
        while (true) {
            int choice = sc.nextInt();
            switch (choice) {
                case 1:
                    addSubway();
                    break;
                case 2:
                    //selectAll();
                    break;
                case 3:
                    System.out.println("感谢您的使用,下次再会!");
                    System.exit(0);
                    break;
                default:
                    System.out.println("您的输入有误,请重新输入...");
            }
        }

    }

    private void addSubway() {
       // String id=getId(false);
       //Subway
    }

    public void login() {
        for (int i = 1; i <= 3; i++) {
            System.out.println("请输入登录账户:");
            String name = sc.next();
            System.out.println("请输入地铁密码:");
            String passwrod = sc.next();
            boolean res = service.login(name, passwrod);
            if (res) {
                System.out.println("恭喜您登录成功!");
                break;
            } else {
                if (i == 3) {
                    System.out.println("您今天的登录机会用完了,请下次再来...");
                } else {
                    System.out.println("您今天还有" + (3 - i) + "次登录机会");
                }
            }
        }

    }


}
